1. Field of the Invention
The present invention relates to an electronic apparatus.
2. Description of the Related Art
Generally speaking, in memory control of an electronic apparatus such as a personal computer (PC), in a case of, for example, executing a program, a required memory area is allocated in a main memory such as a RAM, and the memory area that has been allocated is deallocated after the execution of the program is finished.
For such memory control, there are two methods, i.e., a method using fixed-length memory blocks and a method using variable-length memory blocks. In the method using fixed-length memory blocks, a memory is divided into fixed-length memory blocks, and a required memory area is allocated using respective blocks thereof. In the method using variable-length memory blocks, the size of a memory block to be used for allocation is dynamically changed according to the size of a required memory area.
In memory control using variable-length memory blocks, memory fragmentation may occur. That is, generally speaking, timing of deallocation is random. Thus, after repetitions of allocation and deallocation of memory areas, free space may be fragmented gradually, and available contiguous free spaces may be divided into smaller pieces.
Thus, a technique called “memory compaction” is known for getting rid of fragmented free spaces and carrying out reorganization to obtain long contiguous free spaces.
In addition to the technique of memory compaction, a technique of “garbage collection” is known for automatically deallocating memory areas which become unnecessary from among once allocated memory areas.
As a technique concerning garbage collection, Patent Reference No. 1 (Japanese Laid-Open Patent Application No. 2005-25727) discloses a configuration in which, in response to a garbage collection request, it is determined whether the requested garbage collection is to be carried out, based on a total amount of a calculated free storage capacity before garbage collection processing.
In the above-mentioned memory compaction, there may be a case where even after carrying out memory compaction that requires a processing time, a contiguous memory area having a desired size cannot be obtained.
On that point, Patent Reference No. 1 does not include a description concerning memory compaction, and a method of solving this problem concerning memory compaction is not described.